Converting
Data from One Format to Another
The ACM uses
stream functions to support data format conversion. Converters in the ACM
change the format, but not the data type. For example, a converter module can
change 44-kHz, 16-bit data to 44-kHz, 8-bit data.
The following
ACM functions support data format conversion. They are listed in the order in
which you would typically use them.
The acmStreamOpen function opens a
conversion stream.
The acmStreamSize function calculates the
appropriate size of the source or destination buffer.
The acmStreamPrepareHeader function prepares source
and destination buffers to be used in a conversion.
The acmStreamConvert function converts data in a
source buffer into the destination format, writing the converted data into the
destination buffer.
The acmStreamUnprepareHeader function cleans up the
source and destination buffers prepared by acmStreamPrepareHeader. You
must call this function before freeing the source and destination buffers.
The acmStreamClose function closes a
conversion stream.
When
converting data, first identify the source format, then choose the destination
format. The easiest way to do this is by using the acmFormatChoose
When you know
the source and destination formats, you can use acmStreamOpen
The next step
is to prepare the buffers to be used in the conversion by using acmStreamPrepareHeader
To perform
the conversion, use acmStreamConvert